package com.cn.wanxi.util;

/**
 * 测试Integer的缓存上限修改：
 * （不过请注意：一旦你修改了缓存上限，都存到了常量池中，加大了内存的负担）
 * gc是没有办法回收的！！AutoBoxCacheMax
 *
 * @author mzy
 */
public class TestAutoBoxCache {
//    java -server -Djava.lang.Integer.IntegerCache.high=1000 TestAutoBoxCache
//    java -XX:AutoBoxCacheMax=1000 TestAutoBoxCache
    public static void main(String[] args) {
        Integer a = 127;
        Integer b = 127;
        System.out.println(a == b);

        Integer c = 128;
        Integer d = 128;
        System.out.println(c == d);

        Integer e = 1000;
        Integer f = 1000;
        System.out.println(e == f);

        Integer g = 1001;
        Integer h = 1001;
        System.out.println(g == h);

        Integer i = 20000;
        Integer j = 20000;
        System.out.println(i == j);
    }
}
